import HomePage from "@/views/HomePage";

/**
 * constantRouterMap
 * 没有权限要求的基本页
 * 所有角色都可以访问
 * 不需要动态判断权限的路由
 */
export const constantRouterMap = [
    {
        path: "/",
        name: "GlobalLayout",
        redirect:'/home',
        component: () => import('@/components/Layouts/GlobalLayout'),
        children: [{
            path: "/home",
            name: "home",
            component: HomePage,
            meta: {
                title: "首页",
            },
        }]
    },
    {
        path: "/login",
        name: "login2",
        // redirect:'/login',
        component: () => import('@/views/LoginPage'),
        meta: {
            title: "登录",
        },
    },
    {
        path: "/403",
        name: "403",
        component: () => import("@/views/exception/403Page"),
    },
    {
        path: "/404",
        name: "404",
        component: () => import("@/views/exception/404Page"),
    },
    {
        path: "/500",
        name: "500",
        component: () => import("@/views/exception/500Page"),
    },

];

/**
 * 动态菜单，走权限控制
 *
 * 可从后端获取
 * 可分多个角色
 * 分为三个角色 管理员admin  普通角色 visitor
 */
export const asyncRouterMap = [
    {
        path: "/onlyAdminUserCanSee",
        name: "adminPage",
        component: () => import('@/views/AdminPage'),
        meta: {
            title: "管理员页面",
            keepalive: false,
            roles: ["admin"],
        },
        props: route => ({ msg: route.query.msg })
    },
    {
        path: "/onlyLoginUserCanSee",
        name: "visitPage",
        component: () => import('@/views/VisitorPage'),
        meta: {
            title: "用户界面",
            keepalive: false,
            roles: ["admin", "visitor"],
        },
        props: route => ({ msg: route.query.msg })
    },
    { path: '*', redirect: '/404', component: () => import('@/views/exception/404Page')}
];
